﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PdfControlApp.Pdf
{
    internal class PasswordDictionary
    {
        private static readonly Dictionary<string, string> _filename2password = new();

        public static void SetPassword(string fileName, string password)
        {
            if (string.IsNullOrEmpty(password))
                return;

            _filename2password[fileName.ToLower()] = password;
        }

        public static string GetPassword(string fileName)
        {
            if (_filename2password.TryGetValue(fileName.ToLower(), out var password))
            {
                return password;
            }
            return string.Empty;
        }
    }
}
